<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<html>
<head>
<title>计价系统</title>
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="${ pageContext.request.contextPath }/css/bootstrap.min.css">

<!-- 可选的Bootstrap主题文件（一般不用引入） -->
<link rel="stylesheet" href="${ pageContext.request.contextPath }/css/bootstrap-theme.min.css">

<!-- 引入日期CSS文件 -->
<link rel="stylesheet" href="${ pageContext.request.contextPath }/css/daterangepicker.min.css">

<style type="text/css">
	body{
	padding-top:70px;
	}
</style>
</head>

<body>

	<nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="#">螃蟹计价系统</a>
        </div>
        
        <!-- Collect the nav links, forms, and other content for toggling -->
	    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
	      
	      <ul class="nav navbar-nav">
	        <li><a href="${ pageContext.request.contextPath }/index.jsp">首页<span class="caret"></span></a></li>
	        
	        <li class="dropdown">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">清单创建 </a>
	          <ul class="dropdown-menu">
	            <li><a href="${ pageContext.request.contextPath }/crab_list.do?isOrder=1">收货清单</a></li>
	            <li><a href="${ pageContext.request.contextPath }/crab_list.do?isOrder=0">出货清单</a></li>
	          </ul>
	        </li>
	        
	        <li class="dropdown">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">今日汇总 <span class="caret"></span></a>
	          <ul class="dropdown-menu">
	            <li><a href="${ pageContext.request.contextPath }/order_searchByDate.do?isOrder=1">收货清单</a></li>
	            <li><a href="${ pageContext.request.contextPath }/order_searchByDate.do?isOrder=0">出货清单</a></li>
	            <li role="separator" class="divider"></li>
	            <li><a href="${ pageContext.request.contextPath }/order_searchNumberByDate.do">规格比较</a></li>
	          </ul>
	        </li>
	        
	        <li class="dropdown active">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">清单查询 <span class="sr-only">(current)</span></a>
	          <ul class="dropdown-menu">
	            <li><a href="${ pageContext.request.contextPath }/order_search.do?isOrder=1">收货清单</a></li>
	            <li><a href="${ pageContext.request.contextPath }/order_search.do?isOrder=0">出货清单</a></li>
	            <li><a href="${ pageContext.request.contextPath }/order_searchNumberByTimeUI.do">规格查询</a></li>
	          </ul>
	        </li>
	        
	      </ul>
	     
	      <ul class="nav navbar-nav navbar-right">	
	        <li class="dropdown">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">用户 <span class="sr-only">(current)</span></a>
	          <ul class="dropdown-menu">
	            <li><a href="${ pageContext.request.contextPath }/user_updateUI.do?userid=1">修改用户</a></li>
	          </ul>
	        </li>
	      </ul>
	    </div><!-- /.navbar-collapse -->
       
      </div>
   </nav>

<div class="container">
	<div class="row-fluid">
		<div class="span12">
		<br/>
		<br/>
			<h3 class="text-center">
				<s:if test="#isOrder == 1">
					收货清单查询
				</s:if>
				<s:if test="#isOrder == 0">
					出货清单查询
				</s:if>
			</h3>
			<br/>
			<br/>
			<div class="row clearfix"  id="div_date" >
				<div class="col-md-3"></div>
	       
	    		<div class="col-md-6" >
					<s:form action="order_searchByTime" method="post">
						<input type="hidden" name="isOrder" value="<s:property value='#isOrder'/>"/>
						<div class="form-group">
							<div class="col-sm-10">
								<input  class="form-control" type="text"  id="time" value="" name="time"/>
							</div>
							<div class="col-sm-2">
							 	<input  class="btn" type="submit" value="查找"/>
							 </div>
						</div>
					</s:form>
	    		</div>
	    	
    			<div class="col-md-3"></div>
			</div>
			
			<div class="row clearfix"  id="div_name" style="display:none;"> 
				<div class="col-md-3"></div>
	    		<div class="col-md-6">
					<s:form action="order_searchByName" method="post">
						<input type="hidden" name="isOrder" value="<s:property value='#isOrder'/>"/>	
						<div class="form-group">
							<div class="col-sm-10">
								<input  class="form-control" type="text"  name="name"/>
							</div>
							<div class="col-sm-2">
							 	<input  class="btn" type="submit" value="查找"/>
							 </div>
						</div>
					</s:form>
	    		</div>
	    	
    			<div class="col-md-3"></div>
			</div>
			
			
			<div class="row clearfix"  id="div_id"  style="display:none;">
				<div class="col-md-3"></div>
	       
	    		<div class="col-md-6">
					<s:form action="order_detail" method="post">
						<input type="hidden" name="isOrder" value="<s:property value='#isOrder'/>"/>
					    <input type="hidden" name="radio" value="3"/>
						<div class="form-group">
							<div class="col-sm-10">
								<input  class="form-control" type="text" name="id"/>
							</div>
							<div class="col-sm-2">
							 	<input  class="btn" type="submit" value="查找"/>
							 </div>
						</div>
					</s:form>
	    		</div>
	    	
	    	
    			<div class="col-md-3"></div>
			</div>
	       
	       
    		<br/>
    		
    		<div class="row clearfix">
    			<div class="col-md-3 "></div>
	    		<div class="col-md-6 ">
	    			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					
					<s:if test="#radio==1">
	  					<input type="radio" name="info" id="radio_date" value="1" checked> 按日期查找&nbsp;&nbsp;
					</s:if>
					<s:else>
						<input type="radio" name="info" id="radio_date" value="1" > 按日期查找&nbsp;&nbsp;
					</s:else>
					<s:if test="#radio==2">
	  					<input type="radio" name="info" id="radio_name" value="2" checked> 按客户查找&nbsp;&nbsp;
	  				</s:if>
	  				<s:else>
	  					<input type="radio" name="info" id="radio_name" value="2"> 按客户查找&nbsp;&nbsp;
	  				</s:else>
	  				<s:if test="#radio==3">
	  					<input type="radio" name="info" id="radio_id" value="3" checked> 按清单号查找
					</s:if>
					<s:else>
						<input type="radio" name="info" id="radio_id" value="3"> 按清单号查找
					</s:else>
    			</div>
 
    			<div class="col-md-3"></div>
    		 </div>
	       
			<br/>
			<br/>
    		<br/>
    		<br/>
    		<s:if test="#msg != null && #msg != ''">
	    		<div class="row clearfix">
		    		<div class="col-md-3"></div>
		    		
		    		<div class="col-md-6">
		    			<div class="alert alert-danger" role="alert"><s:property value="#msg" /></div>
		    		</div>
		    		<div class="col-md-3"></div>
	    		</div>
    		</s:if>
    		
    		<s:if test="null != #timeOrderList && !#timeOrderList.isEmpty()">	
    			<div class="row clearfix">
 					<div class="col-md-1">
 					</div>
 					<div class="col-md-10">
 					
					<table class="table table-bordered">
						<caption ><h3><span class="label label-success">日期：${timestr }</span></h3></caption>
						<thead>
							<tr>
								<th>
									单号
								</th>
								<th>
									客户
								</th>
								<th>
									日期
								</th>
								<th>
									母蟹数量
								</th>
								<th>
									公蟹数量
								</th>
								<th>
									总量
								</th>
								<th>
									实付总额
								</th>
								<th>
									操作
								</th>
							</tr>
						</thead>
						<tbody>
							<s:iterator value="timeOrderList">
							
								<tr>
									<td>${id }</td>
									<td>${clientName }</td>
									<td>${date }</td>
									<td>${totalFemaleNum }</td>
									<td>${totalMaleNum }</td>
									<td>${totalNumber }</td>
									<td>${realPay }</td>
									<td>
										<a class="btn btn-default" href="order_detail.do?id=${id }&time=${timestr}&radio=1&isOrder=<s:property value='#isOrder'/>"  role="button">详情</a>
										<a class="btn btn-default" href="order_updateUI.do?id=${id }&time=${timestr}&radio=1&isOrder=<s:property value='#isOrder'/>" role="button">修改</a>
										<a class="btn btn-default" href="order_delete.do?id=${id }&time=${timestr}&radio=1&isOrder=<s:property value='#isOrder'/>" role="button" onClick="return confirm('确认要删除？')">删除</a>
									</td>
								</tr>
							</s:iterator>
							
						</tbody>
					</table> 
					共计：<s:property value="#total.number" />斤（其中母蟹：<s:property value="#total.femaleNum" />斤，公蟹：<s:property value="#total.maleNum" />斤），实付总金额：<s:property value="#total.realPay" />元
				</div>
				<div class="col-md-1"></div>
			</div>
		</s:if>
		
		<s:if test="null != #nameOrderList && !#nameOrderList.isEmpty()">	
    			<div class="row clearfix">
 					<div class="col-md-1">
 					</div>
 					<div class="col-md-10">
 					
					<table class="table table-bordered">
						<caption ><h3><span class="label label-info">客户：${name }</span></h3></caption>
						<thead>
							<tr>
								<th>
									单号
								</th>
								<th>
									日期
								</th>
								<th>
									母蟹数量
								</th>
								<th>
									公蟹数量
								</th>
								<th>
									总量
								</th>
								<th>
									实付总额
								</th>
								<th>
									操作
								</th>
							</tr>
						</thead>
						<tbody>
							<s:iterator value="nameOrderList">
							
								<tr>
									<td>${id }</td>
									<td>${date }</td>
									<td>${totalFemaleNum }</td>
									<td>${totalMaleNum }</td>
									<td>${totalNumber }</td>
									<td>${realPay }</td>
									<td>
										<a class="btn btn-default" href="order_detail.do?id=${id }&radio=2&isOrder=<s:property value='#isOrder'/>" role="button">详情</a>
										<a class="btn btn-default" href="order_updateUI.do?id=${id }&radio=2&isOrder=<s:property value='#isOrder'/>" role="button">修改</a>
										<a class="btn btn-default" href="order_delete.do?id=${id }&name=<s:property value='#name' />&radio=2&isOrder=<s:property value='#isOrder'/>" role="button" onClick="return confirm('确认要删除？')">删除</a>
									</td>
								</tr>
							</s:iterator>
						</tbody>
					</table>
					共计：<s:property value="#total.number" />斤（其中母蟹：<s:property value="#total.femaleNum" />斤，公蟹：<s:property value="#total.maleNum" />斤），实付总金额：<s:property value="#total.realPay" />元 
				</div>
				<div class="col-md-1"></div>
			</div>
		</s:if>
		
		</div>
	</div>
</div>

</body>
</html>

<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="${ pageContext.request.contextPath }/js/jquery.min.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="${ pageContext.request.contextPath }/js/bootstrap.min.js"></script>
<!-- 引入日期JavaScript文件 -->
<script src="${ pageContext.request.contextPath }/js/moment.min.js"></script>
<script src="${ pageContext.request.contextPath }/js/jquery.daterangepicker.min.js"></script>

<script type="text/javascript">
$(function () {

	$('#time').dateRangePicker(
		{
			startOfWeek: 'monday',
			separator : ' ~ ',
			format: 'YYYY-MM-DD HH:mm:ss',
			autoClose: false,
			time: {
				enabled: true
			},
			defaultTime: moment().startOf('day').toDate(),
			defaultEndTime: moment().endOf('day').toDate()
		});
	});
</script>

<script type="text/javascript">
	$(function () {
		var radiovalue = $('input:radio:checked').val();
		if(radiovalue==1){
			$("#div_date").css("display","inline"); 
			$("#div_name").css("display","none"); 
			$("#div_id").css("display","none"); 
		}else if(radiovalue == 2){
			$("#div_date").css("display","none"); 
			$("#div_name").css("display","inline"); 
			$("#div_id").css("display","none"); 
		}else{
			 $("#div_date").css("display","none"); 
			 $("#div_name").css("display","none"); 
			 $("#div_id").css("display","inline"); 
		}
		
		$(":radio").click(function(){
			   if($(this).val()=="1"){
				   $("#div_date").css("display","inline"); 
				   $("#div_name").css("display","none"); 
				   $("#div_id").css("display","none"); 
			   }
			   if($(this).val()=="2"){
				   $("#div_date").css("display","none"); 
				   $("#div_name").css("display","inline"); 
				   $("#div_id").css("display","none"); 
			   }
			   if($(this).val()=="3"){
				   $("#div_date").css("display","none"); 
				   $("#div_name").css("display","none"); 
				   $("#div_id").css("display","inline"); 
			   }
		});
    });
</script>